import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

import District from "./district";
import Map from "./map";
import Organization from "./organization";
import Parameter from "./parameter";
import Device from "./device";

const routes = [
  {
    path: "/index",
    name: "首页",
    component: resolve => require(["@/views/Home"], resolve),
    children: [
      {
        name: "首页",
        path: "/index",
        component: resolve => require(["@/views/index/Index"], resolve)
      },
      ...District,
      ...Map,
      ...Organization,
      ...Parameter,
      ...Device
    ]
  },
  {
    path: "/*",
    redirect: "/index"
  }
];

const router = new VueRouter({
  routes
});

export default router;
